#if (WIZ_CFG_PLATFORM == WIZ_CFG_PLATFORM_WINDOWS)

#include "../WizInnerTimer.hpp"

namespace Wiz
{
    namespace Inner
    {
        namespace Timer
        {
            /// 1s=1,000ms=1,000,000us=1,000,000,000ns
            ::Wiz::Real64::Type Now()
            {
                //////////////////////////////////////////////////////////////////////////
                static LARGE_INTEGER freq;
                static BOOL valid_freq(::QueryPerformanceFrequency(&freq));
                WIZ_ASSERT(valid_freq == TRUE);
                static const ::Wiz::Real64::Type r64_freq = ::Wiz::Cast::Static<::Wiz::Real64::Type>(freq.QuadPart);

                static LARGE_INTEGER init_couter;
                static BOOL valid_ic(::QueryPerformanceCounter(&init_couter));
                WIZ_ASSERT(valid_ic == TRUE);
                //////////////////////////////////////////////////////////////////////////

                LARGE_INTEGER now_counter;
                BOOL valid_nc(::QueryPerformanceCounter(&now_counter));
                WIZ_ASSERT(valid_nc == TRUE);

                now_counter.QuadPart -= init_couter.QuadPart;

                return now_counter.QuadPart / r64_freq;
            }
            //////////////////////////////////////////////////////////////////////////
            ::Wiz::Void::Type Sleep(::Wiz::UInt32::In s)
            {
                ::Sleep(s);
            }
        } /// end of namespace Timer
    } /// end of namespace Inner
} /// end of namespace Wiz

#endif /*#if (WIZ_CFG_PLATFORM == WIZ_CFG_PLATFORM_WINDOWS)*/
